export default function formatTime(date, format = "YYYY-MM-DD HH:mm:ss") {
    const obj = {
        YYYY: date.getFullYear(),
        MM: date.getMonth() + 1,
        DD: date.getDate(),
        HH:date.getHours(),
        mm: date.getMinutes(),
        ss: date.getSeconds()
    }

    for (let key in obj) {
        format = format.replace(key, obj[key]);
    }
    return format;
}